# -*- coding: utf-8 -*-
import os
import tornado.ioloop
import tornado.web
from tornado.options import define, options

from config import TP_PATH
from urls import Handlers

define("port", default=9000, help="run on the given port", type=int)
#
Settings= dict(
    static_path = os.path.join(TP_PATH,"static"),
    debug = True
)

application = tornado.web.Application(Handlers,**Settings)
if __name__ == "__main__":
    #运行服务，如前端配置nginx可开多个端口的监听
    #application.listen(8889)
    application.listen(options.port)
    print "start on port %s..." % options.port
    tornado.ioloop.IOLoop.instance().start()
